<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>重庆企业医院协会 志愿者后台</title>
    <include file="public@head_base"/>
</head>
<body>
<div style="padding: 12px;">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">活动时间</label>
            <div class="layui-input-block">
                <input type="text" name="day" required id="date"  lay-verify="required" placeholder="活动时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">活动地点</label>
            <div class="layui-input-block">
                <input type="text" name="address" required lay-verify="required" placeholder="请输入活动地点" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">主要内容</label>
            <div class="layui-input-block">
                <input type="text" name="content" required lay-verify="required" placeholder="请输入主要内容" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">服务时间</label>
            <div class="layui-input-block">
                <input type="text" name="time" required lay-verify="required" placeholder="请输入服务时间" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea  name="beizhu" required lay-verify="required" placeholder="请输入备注" autocomplete="off" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

</div>
</body>
<script>
    //Demo
    layui.use(['form','laydate'], function(){
        var form = layui.form;
        var laydate = layui.laydate;
        //监听提交
        form.on('submit(formDemo)', function(data){

            $.post("{:url('volunteer/index/addPost')}",data.field,function (res) {
                if(res.code == 1){
                    window.parent.location.reload();
                }else {
                    layer.msg(res.msg);
                    layer.closeAll();
                }
            })
            return false;
        });
        laydate.render({
            elem: '#date' //指定元素
        });
    });
</script>
</html>